<?php

/**
 * InputFortnightAgromet filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseInputFortnightAgrometFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'DTSAVE_TIME'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'IUSER_ID'             => new sfWidgetFormFilterInput(),
      'SWEATHER_TH'          => new sfWidgetFormFilterInput(),
      'SWEATHER_ENG'         => new sfWidgetFormFilterInput(),
      'SWARNING_TH'          => new sfWidgetFormFilterInput(),
      'SWARNING_ENG'         => new sfWidgetFormFilterInput(),
      'SWEATHER_AGROMET_TH'  => new sfWidgetFormFilterInput(),
      'SWEATHER_AGROMET_ENG' => new sfWidgetFormFilterInput(),
      'SREMIND_TH'           => new sfWidgetFormFilterInput(),
      'SREMIND_ENG'          => new sfWidgetFormFilterInput(),
      'SDOC_LINK'            => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'DTSAVE_TIME'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'IUSER_ID'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'SWEATHER_TH'          => new sfValidatorPass(array('required' => false)),
      'SWEATHER_ENG'         => new sfValidatorPass(array('required' => false)),
      'SWARNING_TH'          => new sfValidatorPass(array('required' => false)),
      'SWARNING_ENG'         => new sfValidatorPass(array('required' => false)),
      'SWEATHER_AGROMET_TH'  => new sfValidatorPass(array('required' => false)),
      'SWEATHER_AGROMET_ENG' => new sfValidatorPass(array('required' => false)),
      'SREMIND_TH'           => new sfValidatorPass(array('required' => false)),
      'SREMIND_ENG'          => new sfValidatorPass(array('required' => false)),
      'SDOC_LINK'            => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('input_fortnight_agromet_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'InputFortnightAgromet';
  }

  public function getFields()
  {
    return array(
      'DTTIME_FORECAST'      => 'Date',
      'DTSAVE_TIME'          => 'Date',
      'IUSER_ID'             => 'Number',
      'SWEATHER_TH'          => 'Text',
      'SWEATHER_ENG'         => 'Text',
      'SWARNING_TH'          => 'Text',
      'SWARNING_ENG'         => 'Text',
      'SWEATHER_AGROMET_TH'  => 'Text',
      'SWEATHER_AGROMET_ENG' => 'Text',
      'SREMIND_TH'           => 'Text',
      'SREMIND_ENG'          => 'Text',
      'SDOC_LINK'            => 'Text',
    );
  }
}
